package string.nowcoder.easy;

import java.util.Scanner;

/**
 * @author Stark
 * @description 字符串中最大的数字字符串
 * 题目链接:https://www.nowcoder.com/practice/bd891093881d4ddf9e56e7cc8416562d
 * ?tpId=85&&tqId=29864&rp=1&ru=/activity/oj&qru=/ta/2017test/question-ranking
 * @date 2022/4/20 21:07
 **/
public class LargestNumString {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextLine()){
            //输入字符串时，使用next()时
            //当有空格输入就会判断为下一个字符串,注意题目的输入!!!
            String str = scanner.nextLine();
            str += 'a';
            String retStr = "";
            StringBuilder curStr = new StringBuilder();
            for (int i = 0; i < str.length(); i++) {
                char ch = str.charAt(i);
                if(ch >= '0' && ch <= '9'){
                    curStr.append(ch);
                }else{
                    if(curStr.length() > retStr.length()){
                        retStr = curStr.toString();
                        curStr = new StringBuilder();
                    }
                }
            }
            System.out.println(retStr);
        }
    }
}
